import http from '@/utils/request'

// 发起GET请求
export function httpGet(url,data) {
    return http({
        method: 'GET',
        url,
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded'
        },
        params: data
    })
}


// 发起POST请求
export function httpPost(url,data) {
    return http({
        method: 'POST',
        url,
        data
    })
}

// 发起PUT请求
export function httpPut(url,data) {
    return http({
        method: 'PUT',
        url,
        data
    })
}

// 发起PATCH请求
export function httpPatch(url,data) {
    return http({
        method: 'PATCH',
        url,
        data
    })
}

// 发起DELETE请求
export function httpDelete(url,id) {
    if(id) {
        url = url + '/' + id
    }
    return http({
        method: 'DELETE',
        url
    })
}